package jgl.vajra.kingkong.part.vehicle.activity;

import androidx.recyclerview.widget.LinearLayoutManager;

import jgl.vajra.kingkong.R;
import jgl.vajra.kingkong.bean.HomeVehicleTypeBean;
import jgl.vajra.kingkong.databinding.ActivityVehicleDetailsBinding;
import jgl.vajra.kingkong.part.vehicle.viewModel.VehicleDetailsViewModel;
import jgl.vajra.kingkong.widget.databindingadapter.SingleTypeBindingAdapter;
import jgl.vajra.kingkong.widget.mvvm.factory.CreateViewModel;
import jgl.vajra.kingkong.widget.mvvm.view.BaseMVVMActivity;

@CreateViewModel(VehicleDetailsViewModel.class)
public class VehicleDetailsActivity extends BaseMVVMActivity<VehicleDetailsViewModel, ActivityVehicleDetailsBinding> {
    @Override
    public int getLayoutId() {
        return R.layout.activity_vehicle_details;
    }

    @Override
    public void initView() {
        super.initView();

        HomeVehicleTypeBean data = getIntent().getParcelableExtra("data");
        mBinding.setData(data);

        // 不可嵌套滑动
        mBinding.recyclerView.setNestedScrollingEnabled(false);
        // 取消head 的 recycleView的焦点
        mBinding.recyclerView.setFocusableInTouchMode(false);
        //设置布局管理器
        mBinding.recyclerView.setLayoutManager(new LinearLayoutManager(this));
        SingleTypeBindingAdapter<String> adapter = new SingleTypeBindingAdapter<>(this, data.carParams, R.layout.item_vehicle_details);
        mBinding.recyclerView.setAdapter(adapter);

    }
}
